package com.simp.controller;

import com.simp.page.R;
import com.simp.page.SuperController;
import com.simp.service.SourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author pan.shun
 * @since 2022/3/19 16:16
 */
@Api(tags = "数据源配置")
@RequestMapping("/source")
@RestController
public class SourceController extends SuperController {
    @Autowired
    private SourceService sourceService;

    @ApiOperation(value = "获取表名列表", httpMethod = "GET")
    @GetMapping("/getAllTableNameList")
    public R getAllTableNameList() {
        return sourceService.getAllTableNameList();
    }

    @ApiOperation(value = "通过表名查询表详情", httpMethod = "GET")
    @GetMapping("/getTableDetailsByName/{tableName}")
    public R getTableDetailsByName(
            @ApiParam(value = "tableName", name = "表名", required = true)
            @PathVariable String tableName) {
        return sourceService.getTableDetailsByName(tableName);
    }
}
